var db=require("./db.js");

//-----------    注册管理唐茂    --------------
//用户名是否重复判断
exports.registerByName=function(req,res){
    var rgtByName=req.body.ByName;
    db.db_registerByName(rgtByName,res);
};
//注册用户信息
exports.registerYourNews=function(req,res){
    var new1=req.body.yourByName,
        new2=req.body.yourPasswordTwo,
        new3=req.body.yourName,
        new4=req.body.yourIdCardNum,
        new5=req.body.yourPhoneNum,
        new6=req.body.yourEmail;
    db.db_registerYourNews(new1,new2,new3,new4,new5,new6,res)
};
//登录
exports.loginSend=function(req,res){
    var name=req.body.name;
    var password=req.body.password;
    db.login_db(name,password,res);
};
//登录显示（唐茂）
exports.LoginBN=function(req,res){
    var byName=req.body.BN;
    db.db_LoginBN(byName,res)
};
//查询下单日期（唐茂）
exports.TodayInfo=function(req,res){
    var byTime=req.body.BT;
    db.db_TodayInfo(byTime,res)
};
//退订（唐茂）
exports.TuiDin=function(req,res){
    var Din=req.body.DN;
    db.db_TuiDin(Din,res)
};
//按定票日期查询(唐茂)
exports.ByInfo1=function(req,res){
    var DanNum=req.body.your_id;
    db.db_ByInfo1(DanNum,res)
};
exports.ByInfo2=function(req,res){
    var DanC=req.body.head_word,
        DanName=req.body.your_name;
    db.db_ByInfo2(DanC,DanName,res)
};
//按日期查询显示订单（唐茂）
exports.Show1=function(req,res){
    var showD=req.body.XT;
    db.db_Show1(showD,res)
};
//按乘车日期查询(唐茂)
exports.ByInfo3=function(req,res){
    var DanNum=req.body.your_id;
    db.db_ByInfo1(DanNum,res)
};

//----------廖广元----------
//最近常用
exports.recentlySend=function(req,res){
    var user=req.body.user;
    db.recently_db(user,res);
};

//热门车站
exports.hotSend=function(req,res){
    db.hot_db(req,res);
};

//车站列表
exports.allSend=function(req,res){
    db.all_db(req,res);
};

//锚点
exports.miaoDianSend=function(req,res){
    var val=req.body.val;
    db.miaoDian_db(val,res);
};

//最近常用的搜索
exports.recentlySearchSend=function(req,res){
    var val=req.body.val;
    db.recentlySearch_db(val,res);
};

//火热站台搜索
exports.hotSearchSend=function(req,res){
    var val=req.body.val;
    db.hotSearch_db(val,res);
};

//全部站台搜索
exports.allSearchSend=function(req,res){
    var val=req.body.val;
    db.allSearch_db(val,res);
};

//最近的路线
exports.recRouteShowSend=function(req,res){
    var user=req.body.user;
    db.recRouteShow_db(user,res);
};

//添加最近路线
exports.addRecRouteSend=function(req,res){
    var user=req.body.user;
    var start=req.body.start;
    var end=req.body.end;
    var date=req.body.date
    db.addRecRoute_db(user,start,end,date,res);
};

//查询车票
exports.lookupTicketSend=function(req,res){
    var start=req.body.start;
    var end=req.body.end;
    var godate=req.body.godate;
    var goTimeFirst=req.body.goTimeFirst;
    var goTimeLast=req.body.goTimeLast;
    var carInitialsChoose=req.body.carInitialsChoose;
    db.lookupTicket_db(start,end,godate,goTimeFirst,goTimeLast,carInitialsChoose,res);
};

//添加最近常用车站
exports.addMyRecntlySend=function(req,res){
    var seat=req.body.seat;
    var date=req.body.date;
    var user=req.body.user;
    db.addMyRecntly_db(seat,date,user,res);
};

//加载车票信息
exports.loadingMyinforSend=function(req,res){
    var seat=req.body.seat;
    var date=req.body.date;
    var user=req.body.user;
    db.addMyRecntly_db(seat,date,user,res);
};

//刷新订单信息
exports.falshTicketSend=function(req,res){
    var id=req.body.id;
    db.falshTicket_db(id,res);
};

//加载用户名字和身份证
exports.checkNameSend=function(req,res){
    var user=req.body.user;
    db.checkName_db(user,res);
};

//修改票数
exports.amendVotesSend=function(req,res){
    var count=req.body.count;
    var myId=req.body.myId;
    db.amendVotes_db(count,myId,res);
};

//查看是否买过本次车票
exports.lookupIfBuySend=function(req,res){
    var reallyname=req.body.reallyname;
    var carName=req.body.carName;
    var myDate=req.body.myDate;
    var arriveTime=req.body.arriveTime;
    var startStation=req.body.startStation;
    var endStation=req.body.endStation;
    var buyDate=req.body.buyDate;
    var user=req.body.user;
    db.lookupIfBuySend_db(reallyname,carName,myDate,arriveTime,startStation,endStation,buyDate,user,res);
};


